package cn.mux.jdk8.lambda;

import javax.swing.JFrame;

public class TestMain {
	public static void main(String[] args) {
		/**
		 * 引用类方法
		 */
//		Converter converter = (from)-> Integer.valueOf(from);
		Converter converter = Integer::valueOf;
		Integer val = converter.convert("1234");
		System.out.println(val);
		
		/**
		 * 引用特定对象的实例方法
		 */  
	/*	Converter ct1 = from -> "fkit.org".indexOf(from);*/
		Converter ct1 = "fkit.org"::indexOf;
		Integer val2 = ct1.convert("it");
		System.out.println(val2);
		
		/**
		 * 引用类对象的实例方法
		 */
		
		//MyTest myTest = (a,b,c)->a.substring(b, c);
		MyTest myTest = String::substring;
		String string = myTest.test("hello world",3, 6);
		System.out.println(string);
		
		
		/**
		 * 引用构造器
		 * 、
		 */
		YouTest youTest = JFrame::new;
		System.out.println(youTest.win("helloworld"));
		
	}
}
